#include <string.h>

#if defined(__SDCC_MODEL_LARGE) || defined (__SDCC_MODEL_FLAT24)
#pragma noinduction
#pragma noinvariant
#endif

char * strtok( char * str, const char * control ) {
  static char * s;
  register char * s1;
  if( str )
  { s = str; }
  if( !s )
  { return NULL; }
  while( *s ) {
    if( strchr( control, *s ) )
    { s++; }
    else
    { break; }
  }
  s1 = s;
  while( *s ) {
    if( strchr( control, *s ) ) {
      *s++ = '\0';
      return s1;
    }
    s++ ;
  }
  s = NULL;
  if( *s1 )
  { return s1; }
  else
  { return NULL; }
}
